<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>社交活动平台 - 标签管理</title>
    <style>
        /* 重置样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }

        /* 容器样式 */
        .container {
            max-width: 480px;
            margin: 0 auto;
            background-color: #fff;
            min-height: 100vh;
        }

        /* 头部导航 */
        .header {
            position: sticky;
            top: 0;
            background-color: white;
            padding: 16px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            z-index: 100;
        }

        .header-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .back-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #333;
        }

        .header-title {
            font-size: 18px;
            font-weight: bold;
            flex-grow: 1;
            text-align: center;
        }

        .action-btn {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #333;
        }

        /* 搜索区域 */
        .search-section {
            padding: 16px;
            background-color: #f9f9f9;
            border-bottom: 1px solid #eee;
        }

        .search-container {
            display: flex;
            align-items: center;
            background-color: white;
            border-radius: 24px;
            padding: 8px 16px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        .search-icon {
            color: #999;
            margin-right: 8px;
        }

        .search-input {
            flex-grow: 1;
            border: none;
            outline: none;
            font-size: 15px;
            background-color: transparent;
        }

        /* 标签管理头部 */
        .tags-header {
            padding: 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #eee;
        }

        .tags-title {
            font-size: 18px;
            font-weight: bold;
        }

        .tags-count {
            color: #666;
            font-size: 14px;
        }

        /* 标签容器 */
        .tags-container {
            padding: 16px;
        }

        /* 标签分类标题 */
        .category-title {
            font-size: 16px;
            font-weight: bold;
            margin: 20px 0 12px;
            color: #333;
        }

        /* 标签列表 */
        .tags-list {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
        }

        /* 标签项 */
        .tag-item {
            padding: 10px 20px;
            border-radius: 24px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .tag-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }

        .tag-item.selected {
            background: linear-gradient(135deg, #ff6b35 0%, #f9a825 100%);
            color: white;
        }

        .tag-item.unselected {
            background-color: #f0f0f0;
            color: #666;
        }

        .tag-item.unselected:hover {
            background-color: #e0e0e0;
        }

        .tag-icon {
            font-size: 16px;
        }

        /* 推荐标签 */
        .recommended-tags {
            margin-top: 20px;
        }

        /* 自定义标签区域 */
        .custom-tags-section {
            margin-top: 30px;
            padding: 16px;
            background-color: #f9f9f9;
            border-radius: 12px;
        }

        .custom-tags-header {
            font-size: 16px;
            font-weight: bold;
            margin-bottom: 16px;
        }

        .custom-tags-list {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
        }

        .custom-tag-item {
            padding: 8px 16px;
            background-color: #e3f2fd;
            border-radius: 20px;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .custom-tag-remove {
            color: #ff5252;
            font-weight: bold;
            cursor: pointer;
        }

        /* 添加标签区域 */
        .add-tag-section {
            margin-top: 20px;
            padding: 16px;
        }

        .add-tag-container {
            display: flex;
            gap: 12px;
        }

        .tag-input {
            flex-grow: 1;
            padding: 12px 16px;
            border-radius: 24px;
            border: 1px solid #ddd;
            font-size: 15px;
            outline: none;
        }

        .tag-input:focus {
            border-color: #ff6b35;
        }

        .add-tag-btn {
            background: linear-gradient(135deg, #45b7d1 0%, #2c8cb9 100%);
            color: white;
            border: none;
            padding: 12px 20px;
            border-radius: 24px;
            font-size: 15px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .add-tag-btn:hover {
            transform: scale(1.05);
        }

        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: white;
            border-top: 1px solid #eee;
            display: flex;
            justify-content: space-around;
            padding: 12px 0;
            z-index: 100;
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #9e9e9e;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .nav-item.active {
            color: #ff6b35;
        }

        .nav-icon {
            font-size: 20px;
            margin-bottom: 4px;
        }

        /* 加载动画 */
        .loading {
            text-align: center;
            padding: 40px 20px;
        }

        .spinner {
            width: 36px;
            height: 36px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid #ff6b35;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* 弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background-color: white;
            border-radius: 16px;
            width: 85%;
            max-width: 320px;
            padding: 24px;
            text-align: center;
            transform: translateY(20px);
            opacity: 0;
            transition: all 0.3s ease;
        }

        .modal.show {
            transform: translateY(0);
            opacity: 1;
        }

        .modal-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 16px;
            color: #333;
        }

        .modal-message {
            margin-bottom: 24px;
            color: #666;
            line-height: 1.6;
        }

        .modal-actions {
            display: flex;
            gap: 12px;
        }

        .modal-btn {
            flex: 1;
            padding: 12px;
            border-radius: 8px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .cancel-btn {
            background-color: #f5f5f5;
            color: #666;
        }

        .confirm-btn {
            background: linear-gradient(135deg, #ff6b35 0%, #f9a825 100%);
            color: white;
        }

        /* 响应式适配 */
        @media (max-width: 480px) {
            .header-content {
                padding-top: 4px;
            }
            
            .tag-item {
                padding: 8px 16px;
                font-size: 13px;
            }
        }

        /* 动画效果 */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .tag-item {
            animation: fadeInUp 0.6s ease forwards;
        }

        /* 标签类型颜色 */
        .tag-type-sport { background-color: #e3f2fd; color: #1976d2; }
        .tag-type-learning { background-color: #f3e5f5; color: #7b1fa2; }
        .tag-type-social { background-color: #e8f5e9; color: #388e3c; }
        .tag-type-food { background-color: #fff3e0; color: #f57c00; }
        .tag-type-culture { background-color: #fce4ec; color: #c2185b; }
        .tag-type-outdoor { background-color: #e0f2f1; color: #00796b; }
        .tag-type-music { background-color: #f1f8e9; color: #33691e; }
        .tag-type-art { background-color: #fff8e1; color: #ff8f00; }
        .tag-type-tech { background-color: #e1bee7; color: #7b1fa2; }
        .tag-type-travel { background-color: #e0f7fa; color: #00838f; }

        /* 标签类型图标 */
        .tag-icon-sport::before { content: "🏃"; }
        .tag-icon-learning::before { content: "📚"; }
        .tag-icon-social::before { content: "👥"; }
        .tag-icon-food::before { content: "🍽️"; }
        .tag-icon-culture::before { content: "🎭"; }
        .tag-icon-outdoor::before { content: "🌲"; }
        .tag-icon-music::before { content: "🎵"; }
        .tag-icon-art::before { content: "🎨"; }
        .tag-icon-tech::before { content: "💻"; }
        .tag-icon-travel::before { content: "✈️"; }

        /* 空状态 */
        .empty-state {
            text-align: center;
            padding: 60px 20px;
        }

        .empty-icon {
            font-size: 48px;
            margin-bottom: 20px;
            color: #ccc;
        }

        .empty-title {
            font-size: 16px;
            font-weight: bold;
            margin-bottom: 12px;
            color: #666;
        }

        .empty-description {
            color: #999;
            margin-bottom: 24px;
        }

        /* 已选标签指示器 */
        .selected-indicator {
            display: inline-block;
            width: 6px;
            height: 6px;
            background-color: #ff6b35;
            border-radius: 50%;
            margin-left: 8px;
        }

        /* 标签推荐提示 */
        .tag-recommendation {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 4px;
            font-size: 12px;
            color: #999;
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 头部导航 -->
        <header class="header">
            <div class="header-content">
                <button class="back-btn" id="backBtn">←</button>
                <div class="header-title">标签管理</div>
                <button class="action-btn" id="saveBtn">保存</button>
            </div>
        </header>

        <!-- 搜索区域 -->
        <div class="search-section">
            <div class="search-container">
                <span class="search-icon">🔍</span>
                <input type="text" class="search-input" placeholder="搜索标签..." id="searchInput">
            </div>
        </div>

        <!-- 标签管理头部 -->
        <div class="tags-header">
            <div class="tags-title">我的兴趣标签</div>
            <div class="tags-count">已选 8 个标签</div>
        </div>

        <!-- 标签容器 -->
        <div class="tags-container">
            <!-- 运动类标签 -->
            <h3 class="category-title">运动健身</h3>
            <div class="tags-list" id="sportTags">
                <div class="tag-item tag-type-sport unselected" data-tag-id="1" data-tag-name="运动">
                    <span class="tag-icon tag-icon-sport"></span>
                    运动
                </div>
                <div class="tag-item tag-type-sport unselected" data-tag-id="2" data-tag-name="跑步">
                    <span class="tag-icon tag-icon-sport"></span>
                    跑步
                </div>
                <div class="tag-item tag-type-sport unselected" data-tag-id="3" data-tag-name="游泳">
                    <span class="tag-icon tag-icon-sport"></span>
                    游泳
                </div>
                <div class="tag-item tag-type-sport unselected" data-tag-id="4" data-tag-name="瑜伽">
                    <span class="tag-icon tag-icon-sport"></span>
                    瑜伽
                </div>
                <div class="tag-item tag-type-sport unselected" data-tag-id="5" data-tag-name="骑行">
                    <span class="tag-icon tag-icon-sport"></span>
                    骑行
                </div>
            </div>

            <!-- 学习类标签 -->
            <h3 class="category-title">学习成长</h3>
            <div class="tags-list" id="learningTags">
                <div class="tag-item tag-type-learning unselected" data-tag-id="6" data-tag-name="学习">
                    <span class="tag-icon tag-icon-learning"></span>
                    学习
                </div>
                <div class="tag-item tag-type-learning unselected" data-tag-id="7" data-tag-name="读书">
                    <span class="tag-icon tag-icon-learning"></span>
                    读书
                </div>
                <div class="tag-item tag-type-learning unselected" data-tag-id="8" data-tag-name="语言">
                    <span class="tag-icon tag-icon-learning"></span>
                    语言
                </div>
                <div class="tag-item tag-type-learning unselected" data-tag-id="9" data-tag-name="编程">
                    <span class="tag-icon tag-icon-learning"></span>
                    编程
                </div>
            </div>

            <!-- 社交类标签 -->
            <h3 class="category-title">社交互动</h3>
            <div class="tags-list" id="socialTags">
                <div class="tag-item tag-type-social unselected" data-tag-id="10" data-tag-name="社交">
                    <span class="tag-icon tag-icon-social"></span>
                    社交
                </div>
                <div class="tag-item tag-type-social unselected" data-tag-id="11" data-tag-name="聚会">
                    <span class="tag-icon tag-icon-social"></span>
                    聚会
                </div>
                <div class="tag-item tag-type-social unselected" data-tag-id="12" data-tag-name="交友">
                    <span class="tag-icon tag-icon-social"></span>
                    交友
                </div>
            </div>

            <!-- 美食类标签 -->
            <h3 class="category-title">美食文化</h3>
            <div class="tags-list" id="foodTags">
                <div class="tag-item tag-type-food unselected" data-tag-id="13" data-tag-name="美食">
                    <span class="tag-icon tag-icon-food"></span>
                    美食
                </div>
                <div class="tag-item tag-type-food unselected" data-tag-id="14" data-tag-name="烘焙">
                    <span class="tag-icon tag-icon-food"></span>
                    烘焙
                </div>
                <div class="tag-item tag-type-food unselected" data-tag-id="15" data-tag-name="咖啡">
                    <span class="tag-icon tag-icon-food"></span>
                    咖啡
                </div>
            </div>

            <!-- 文化类标签 -->
            <h3 class="category-title">文化娱乐</h3>
            <div class="tags-list" id="cultureTags">
                <div class="tag-item tag-type-culture unselected" data-tag-id="16" data-tag-name="文化">
                    <span class="tag-icon tag-icon-culture"></span>
                    文化
                </div>
                <div class="tag-item tag-type-culture unselected" data-tag-id="17" data-tag-name="电影">
                    <span class="tag-icon tag-icon-culture"></span>
                    电影
                </div>
                <div class="tag-item tag-type-culture unselected" data-tag-id="18" data-tag-name="音乐">
                    <span class="tag-icon tag-icon-culture"></span>
                    音乐
                </div>
                <div class="tag-item tag-type-culture unselected" data-tag-id="19" data-tag-name="艺术">
                    <span class="tag-icon tag-icon-culture"></span>
                    艺术
                </div>
            </div>

            <!-- 户外类标签 -->
            <h3 class="category-title">户外探险</h3>
            <div class="tags-list" id="outdoorTags">
                <div class="tag-item tag-type-outdoor unselected" data-tag-id="20" data-tag-name="户外">
                    <span class="tag-icon tag-icon-outdoor"></span>
                    户外
                </div>
                <div class="tag-item tag-type-outdoor unselected" data-tag-id="21" data-tag-name="徒步">
                    <span class="tag-icon tag-icon-outdoor"></span>
                    徒步
                </div>
                <div class="tag-item tag-type-outdoor unselected" data-tag-id="22" data-tag-name="露营">
                    <span class="tag-icon tag-icon-outdoor"></span>
                    露营
                </div>
            </div>

            <!-- 推荐标签 -->
            <h3 class="category-title">为你推荐</h3>
            <div class="recommended-tags">
                <div class="tag-item tag-type-music unselected" data-tag-id="23" data-tag-name="音乐">
                    <span class="tag-icon tag-icon-music"></span>
                    音乐
                </div>
                <div class="tag-item tag-type-art unselected" data-tag-id="24" data-tag-name="艺术">
                    <span class="tag-icon tag-icon-art"></span>
                    艺术
                </div>
                <div class="tag-item tag-type-tech unselected" data-tag-id="25" data-tag-name="科技">
                    <span class="tag-icon tag-icon-tech"></span>
                    科技
                </div>
                <div class="tag-item tag-type-travel unselected" data-tag-id="26" data-tag-name="旅行">
                    <span class="tag-icon tag-icon-travel"></span>
                    旅行
                </div>
            </div>

            <!-- 自定义标签区域 -->
            <div class="custom-tags-section">
                <h3 class="custom-tags-header">我的自定义标签</h3>
                <div class="custom-tags-list" id="customTagsList">
                    <div class="custom-tag-item">
                        摄影
                        <span class="custom-tag-remove">×</span>
                    </div>
                    <div class="custom-tag-item">
                        摄影
                        <span class="custom-tag-remove">×</span>
                    </div>
                </div>
            </div>

            <!-- 添加标签区域 -->
            <div class="add-tag-section">
                <h3 class="custom-tags-header">添加新标签</h3>
                <div class="add-tag-container">
                    <input type="text" class="tag-input" id="newTagInput" placeholder="输入新标签名称">
                    <button class="add-tag-btn" id="addTagBtn">添加</button>
                </div>
            </div>
        </div>

        <!-- 底部导航 -->
        <nav class="bottom-nav">
            <div class="nav-item" data-page="home">
                <span class="nav-icon">🏠</span>
                <span>首页</span>
            </div>
            <div class="nav-item" data-page="search">
                <span class="nav-icon">🔍</span>
                <span>搜索</span>
            </div>
            <div class="nav-item" data-page="publish">
                <span class="nav-icon">➕</span>
                <span>发布</span>
            </div>
            <div class="nav-item active" data-page="profile">
                <span class="nav-icon">👤</span>
                <span>我的</span>
            </div>
        </nav>

        <!-- 加载状态 -->
        <div class="loading" id="loadingIndicator">
            <div class="spinner"></div>
            <p>加载中...</p>
        </div>

        <!-- 通知 Toast -->
        <div id="toast" style="display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #4caf50; color: white; padding: 12px 24px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1001;"></div>
    </div>

    <script>
        // 全局变量
        let selectedTags = new Set([1, 2, 6, 10, 13, 16, 20]); // 模拟已选标签
        let customTags = ['摄影', '旅行']; // 自定义标签

        // 初始化
        document.addEventListener('DOMContentLoaded', function() {
            initEventListeners();
            simulateLoading();
            
            // 初始化标签显示
            updateTagDisplay();
        });

        // 初始化事件监听器
        function initEventListeners() {
            // 返回按钮
            document.getElementById('backBtn').addEventListener('click', function() {
                window.history.back();
            });

            // 保存按钮
            document.getElementById('saveBtn').addEventListener('click', function() {
                showSuccessToast(`已保存 ${selectedTags.size} 个标签`);
            });

            // 底部导航切换
            const navItems = document.querySelectorAll('.nav-item');
            navItems.forEach(item => {
                item.addEventListener('click', function() {
                    // 移除所有激活状态
                    navItems.forEach(i => i.classList.remove('active'));
                    // 添加当前激活状态
                    this.classList.add('active');
                    
                    const page = this.dataset.page;
                    handleNavigation(page);
                });
            });

            // 标签点击事件
            const tagItems = document.querySelectorAll('.tag-item');
            tagItems.forEach(item => {
                item.addEventListener('click', function() {
                    const tagId = this.dataset.tagId;
                    toggleTagSelection(tagId, this);
                });
            });

            // 自定义标签删除
            const customTagRemove = document.querySelectorAll('.custom-tag-remove');
            customTagRemove.forEach(removeBtn => {
                removeBtn.addEventListener('click', function(e) {
                    e.stopPropagation();
                    const tagItem = this.closest('.custom-tag-item');
                    const tagName = tagItem.textContent.replace('×', '').trim();
                    
                    // 移除自定义标签
                    const index = customTags.indexOf(tagName);
                    if (index > -1) {
                        customTags.splice(index, 1);
                        tagItem.remove();
                        showSuccessToast(`已删除标签 "${tagName}"`);
                    }
                });
            });

            // 添加新标签
            document.getElementById('addTagBtn').addEventListener('click', function() {
                const input = document.getElementById('newTagInput');
                const tagName = input.value.trim();
                
                if (tagName && !customTags.includes(tagName)) {
                    customTags.push(tagName);
                    addCustomTagToUI(tagName);
                    input.value = '';
                    showSuccessToast(`已添加新标签 "${tagName}"`);
                } else if (customTags.includes(tagName)) {
                    showSuccessToast(`标签 "${tagName}" 已存在`);
                } else {
                    showSuccessToast('请输入有效的标签名称');
                }
            });

            // 回车添加标签
            document.getElementById('newTagInput').addEventListener('keypress', function(e) {
                if (e.key === 'Enter') {
                    document.getElementById('addTagBtn').click();
                }
            });

            // 搜索功能
            const searchInput = document.getElementById('searchInput');
            searchInput.addEventListener('input', function() {
                const searchTerm = this.value.toLowerCase();
                filterTags(searchTerm);
            });

            // 模拟标签数据更新
            setInterval(() => {
                updateTagDisplay();
            }, 30000); // 每30秒更新一次
        }

        // 切换标签选择状态
        function toggleTagSelection(tagId, element) {
            const tagInt = parseInt(tagId);
            
            if (selectedTags.has(tagInt)) {
                // 取消选择
                selectedTags.delete(tagInt);
                element.classList.remove('selected');
                element.classList.add('unselected');
            } else {
                // 选择标签
                selectedTags.add(tagInt);
                element.classList.remove('unselected');
                element.classList.add('selected');
            }
            
            // 更新标签计数
            updateTagCount();
        }

        // 更新标签显示状态
        function updateTagDisplay() {
            const tagItems = document.querySelectorAll('.tag-item');
            
            tagItems.forEach(item => {
                const tagId = parseInt(item.dataset.tagId);
                
                if (selectedTags.has(tagId)) {
                    item.classList.remove('unselected');
                    item.classList.add('selected');
                } else {
                    item.classList.remove('selected');
                    item.classList.add('unselected');
                }
            });
        }

        // 更新标签计数
        function updateTagCount() {
            const countElement = document.querySelector('.tags-count');
            if (countElement) {
                countElement.textContent = `已选 ${selectedTags.size} 个标签`;
            }
        }

        // 添加自定义标签到UI
        function addCustomTagToUI(tagName) {
            const customTagsList = document.getElementById('customTagsList');
            
            const tagItem = document.createElement('div');
            tagItem.className = 'custom-tag-item';
            tagItem.innerHTML = `
                ${tagName}
                <span class="custom-tag-remove">×</span>
            `;
            
            // 添加删除事件
            tagItem.querySelector('.custom-tag-remove').addEventListener('click', function(e) {
                e.stopPropagation();
                const index = customTags.indexOf(tagName);
                if (index > -1) {
                    customTags.splice(index, 1);
                    tagItem.remove();
                    showSuccessToast(`已删除标签 "${tagName}"`);
                }
            });
            
            customTagsList.appendChild(tagItem);
        }

        // 过滤标签
        function filterTags(searchTerm) {
            const tagItems = document.querySelectorAll('.tag-item');
            
            tagItems.forEach(item => {
                const tagName = item.dataset.tagName.toLowerCase();
                
                if (searchTerm === '' || tagName.includes(searchTerm)) {
                    item.style.display = 'flex';
                } else {
                    item.style.display = 'none';
                }
            });
        }

        // 处理导航切换
        function handleNavigation(page) {
            switch(page) {
                case 'home':
                    alert('跳转到首页');
                    break;
                case 'search':
                    alert('跳转到搜索页面');
                    break;
                case 'publish':
                    alert('跳转到发布页面');
                    break;
                case 'profile':
                    // 个人中心无需特殊处理
                    break;
            }
        }

        // 显示加载状态
        function showLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'block';
        }

        // 隐藏加载状态
        function hideLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'none';
        }

        // 模拟加载效果
        function simulateLoading() {
            showLoading();
            setTimeout(() => {
                hideLoading();
            }, 1500);
        }

        // 显示成功提示
        function showSuccessToast(message) {
            const toast = document.getElementById('toast');
            toast.textContent = message;
            toast.style.display = 'block';
            
            // 3秒后自动隐藏
            setTimeout(() => {
                toast.style.display = 'none';
            }, 3000);
        }

        // 添加触摸反馈效果
        const buttons = document.querySelectorAll('button, .tag-item');
        buttons.forEach(button => {
            button.addEventListener('touchstart', function() {
                this.style.transform = 'scale(0.95)';
            });
            
            button.addEventListener('touchend', function() {
                this.style.transform = 'scale(1)';
            });
        });

        // 添加页面滚动效果
        let lastScrollTop = 0;
        window.addEventListener('scroll', function() {
            const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
            
            // 隐藏/显示底部导航
            const bottomNav = document.querySelector('.bottom-nav');
            if (scrollTop > lastScrollTop && scrollTop > 100) {
                bottomNav.style.transform = 'translateY(100%)';
            } else {
                bottomNav.style.transform = 'translateY(0)';
            }
            
            lastScrollTop = scrollTop;
        });

        // 添加返回顶部功能
        window.addEventListener('scroll', function() {
            if (window.pageYOffset > 300) {
                // 可以添加返回顶部按钮
            }
        });
    </script>
</body>
</html>
